package com.happyscan138.makefun.base;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.PopupWindow;

import com.happyscan138.makefun.R;

/**
 * Created by Administrator on 2017/3/3.
 */

 public  class WaitNetDataPop {
    private Context mContext;
    public LayoutInflater inflater;
    public View Popview;
    private PopupWindow pop;

    public WaitNetDataPop(Context mContext ) {
        this.mContext=mContext;

    }
    public  void displayPop(){

        inflater = LayoutInflater.from(mContext);
        Popview= inflater.inflate(R.layout.waiting, null);
        pop = new PopupWindow(Popview, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, false);
        pop.setOutsideTouchable(false);
        pop.setFocusable(true);
        ImageView loadingImg = (ImageView) Popview.findViewById(R.id.loading_imageView_info);
        Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.tip);
        loadingImg.startAnimation(anim);
        pop.showAsDropDown(Popview);

    }
    public void dismiss(){
        if(pop!=null){
            pop.dismiss();
        }
    }
    public boolean isPaly(){
        if(pop.isShowing()){
            return true;
        }else {
            return false;
        }
    }
}
